typedef  coverData<T> = T Function(Map<String,dynamic> map);
class ResponseData<T extends BaseListData>{
  String? code;
  String? msg;
  String? version;
  NetResponseDataBean<T>? data;
  coverData<T>? builder;

  ResponseData({this.code, this.msg, this.version, this.data,this.builder});

  ResponseData.fromJson(Map<dynamic, dynamic> json,{coverData<T>? listBuilder}) {
    this.code = json['code'];
    this.msg = json['msg'];
    this.version = json['version'].toString();
    this.data = json['data'] != null ? NetResponseDataBean.fromJson(json['data'],listBuilder) : null;
    this.builder = listBuilder;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['code'] = this.code;
    data['msg'] = this.msg;
    data['version'] = this.version;
    if (this.data != null) {
      data['data'] = this.data?.toJson();
    }
    return data;
  }

}

class NetResponseDataBean<T extends BaseListData> {
  int? total;
  List<T>? rows;

  NetResponseDataBean({this.total, this.rows});

  NetResponseDataBean.fromJson(Map<String, dynamic> json,coverData<T>? builder) {
    this.total = json['total'];
    if(builder!=null){
      this.rows = (json['rows'])!=null?(json['rows'] as List).map((i) => builder(i)).toList():null;
    }else{
      this.rows = null;
    }

  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['total'] = this.total;
    data['rows'] = this.rows != null?this.rows?.map((i) => i.toJson()).toList():null;
    return data;
  }
}

abstract class  BaseListData {
  Map<String, dynamic> toJson();
}


class ResponseBean{
  String? code;
  String? msg;
  String? version;
  dynamic data;


  ResponseBean({this.code, this.msg, this.version, this.data});

  ResponseBean.fromJson(Map<dynamic, dynamic> json) {
    this.code = json['code'];
    this.msg = json['msg'];
    this.version = json['version'].toString();
    this.data = json['data'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['code'] = this.code;
    data['msg'] = this.msg;
    data['version'] = this.version;
    if (this.data != null) {
      data['data'] = this.data;
    }
    return data;
  }

}

